package StackAndQueue;

import java.util.Stack;

public class StackTest {
    public static void main(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        System.out.println(stack);

        int head = stack.peek();
        System.out.println(head);

        stack.pop();
        System.out.println(stack);

        int count = stack.size();
        System.out.println(count);

        if(stack.empty()){
            System.out.println("栈为空");
        }else {
            System.out.println("栈不为空");
        }
    }
}
